package com.zr.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.NewlyIincreasedStaffDao;
import com.zr.model.LMdistributionPerson;

/**
 * 配送点管理员管理配送点员工
 * @author wzp
 *
 * @param <T>
 */
@Repository(value="NStaffdao")
public class NewlyIincreasedStaffDaoImpl<T> extends BaseDaOImpl<T> implements NewlyIincreasedStaffDao<T> {

	@Override
	public List<LMdistributionPerson> findStaff(int rows, int page, int uid) {
		// TODO Auto-generated method stub
		StringBuffer hql = new StringBuffer("from LMdistributionPerson lp where lp.LMuser.uid=?");
		Object[]  param  =  new Object[]{uid};
		return (List<LMdistributionPerson>) this.find(hql.toString(), param, page, rows);
	}

	@Override
	public int findNumStaff(int uid) {
		// TODO Auto-generated method stub
		String hql = "from LMdistributionPerson lmp where lmp.LMuser.uid=:uid";
		Query query = this.getCurrentSession().createQuery(hql);
		query.setInteger("uid", uid);
		int staffnum = query.list().size();
		return staffnum;
	}


}
